package servlet.admin;

import entity.Field;
import service.FieldService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet( name = "AdminFieldServlet")
public class AdminFieldServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        FieldService fieldService=new FieldService();
        List<Field> fieldList=fieldService.fieldList();
        request.setAttribute("fieldList",fieldList);
        request.getServletContext().getRequestDispatcher("/admin/field.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
